package common.fengkai.filepost.utils;

import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import java.io.FileOutputStream;
import java.io.IOException;

public class GetPdfByUrlUtil {


       public static void main(String[] args) throws Exception {
           RestTemplate client = new RestTemplate();
           String url = "http://10.29.27.191:8081/ips-file/third_party_mental_health/00265357154e45d962e4da07c5512145298ef6b4857b0fc64f6c10f7e4b48872f8c352ae0d3c3071d8ddad942e834c5b6b1bf4f03daa2b5687f60e1e4943941163ec004a2fe1e2e26c3172ca70dbe4a616d5d76e7ea5dd99819930efd86f42e8";
           ResponseEntity<byte[]> response = client.getForEntity(url,byte[].class);
           byte[] body = response.getBody();
           try {
               String s = Base64util.decoderBytesFileToBase64(body);
               Base64util.decoderBase64File(s,"H:\\太平印章项目\\服务器资源\\123456.pdf","H:\\太平印章项目\\服务器资源");
               System.out.println(s.length());
           } catch (IOException e) {
               e.printStackTrace();
           }


           FileOutputStream fos = null;





          }
}
